cssfiltervalue: Fix blur filter interpretation
authorMatthias Clasen <mclasen@redhat.com>
Sat, 6 Feb 2021 03:06:56 +0000 (22:06 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 6 Feb 2021 21:16:44 +0000 (16:16 -0500)
According to https://www.w3.org/TR/filter-effects-1/,
the length passed to blur() is the standard deviation,
and according to https://www.w3.org/TR/css-backgrounds-3/#shadow-blur
the blur radius is twice the standard deviation.

gtk/gtkcssfiltervalue.c

index ecc225a9258f1782685d5d22633ae293611ae56a..eaf11c16b5ddf4b8a18b298e142f17707595d38f 100644 (file)
@@ -939,7 +939,6 @@ gtk_css_filter_value_push_snapshot (const GtkCssValue *filter,
   graphene_matrix_t matrix;
   graphene_vec4_t offset;
   int i, j;
-  double radius;
 
   if (gtk_css_filter_value_is_none (filter))
     return;
@@ -955,8 +954,8 @@ gtk_css_filter_value_push_snapshot (const GtkCssValue *filter,
         {
           if (filter->filters[j].type == GTK_CSS_FILTER_BLUR)
             {
-              radius = _gtk_css_number_value_get (filter->filters[j].blur.value, 100.0);
-              gtk_snapshot_push_blur (snapshot, radius);
+              double std_dev = _gtk_css_number_value_get (filter->filters[j].blur.value, 100.0);
+              gtk_snapshot_push_blur (snapshot, 2 * std_dev);
             }
           else if (filter->filters[j].type == GTK_CSS_FILTER_DROP_SHADOW)
             {